package com.agile.leetcode.random;

import java.util.Random;

/**
 * @Author:ChenZhangKun
 * @Date: 2022/9/11 15:00
 */
public class RandomTest {
    public static void main(String[] args) {
        // hello world

        System.out.println(randomString(-229985452) + " " + randomString(-147909649));

        System.out.println(randomString(-9223372016744809652L));
    }

    public static String randomString(long i) {
        Random random = new Random(i);
        StringBuilder builder = new StringBuilder();
        for (; ; ) {
            // 当前random指定了种子值，其生成的数字序列每次是一致的，所以random被定义为伪随机值
            int k = random.nextInt(27);
            if (k == 0) break;
            builder.append((char) ('`' + k));
        }
        return builder.toString();
    }
}
